#pragma once
#define interface struct

//===========================================================================
// enum EPieceType
//===========================================================================
enum EPieceType {
    EPT_NONE,
    EPT_BLACK,
    EPT_WHITE,
        
    EPT_COUNT
};

//===========================================================================
// enum ECourse
//===========================================================================
enum ECourse {
    EC_NONE  = 1 << 0,
    EC_LEFT  = 1 << 1,
    EC_RIGHT = 1 << 2
};

//===========================================================================
// interface IPosition
//===========================================================================
interface IPosition
{
    virtual unsigned int GetX( void ) const = 0;
    virtual unsigned int GetY( void ) const = 0;
};

//===========================================================================
// interface IBoard
//===========================================================================
interface IBoard
{
    virtual unsigned int GetSize( void ) const = 0;
    
    virtual void Show( void ) const = 0;
    
    virtual const EPieceType * GetPiece(
        const IPosition & position
    ) const = 0;

    virtual bool IsValidPosition(
        const IPosition & position
    ) const = 0;
    
    virtual bool Set(
        const IPosition & position,
              EPieceType  piece
    ) = 0;
    
    virtual bool Take(
        const IPosition & position
    ) = 0;

    virtual bool IsGameOver( void ) const = 0;

    virtual void Release( void ) = 0;
};

//===========================================================================
IBoard * CreateBoard(
    unsigned int size,
    EPieceType   user,
    EPieceType   computer
);

//===========================================================================
// interface IPlayer
//===========================================================================
interface IPlayer
{
    virtual bool Move( void ) = 0;

    virtual void Release( void ) = 0;
};

//===========================================================================
IPlayer * CreatePlayer(
    EPieceType piece,
    IBoard *   board
);

//===========================================================================
IPlayer * CreatePlayerAI(
    EPieceType piece,
    IBoard *   board
);